package com.woniuxy02;

import java.io.Serializable;
import java.util.Comparator;

/**
 * @author 作者
 * @create 2025-09-08 16:31
 */
public class StudentAgeDesc implements Comparator {


    @Override
    public int compare(Object o1, Object o2) {
//        if(o1 instanceof Student && o2 instanceof Student){
//            Student s1 = (Student)o1;
//            Student s2 = (Student)o2;
//        }
        if(o1 instanceof Student s1 && o2 instanceof Student s2){
            return s2.getAge()-s1.getAge();
        }

        return 0;
    }
}
